$(function(){
	new Vue({
		el:"#applyShopListApp",
		data:{
			searchMember:"",
			dialogFormVisible:false,
			formLabelWidth:"180px",
			form:{
			   reason:"",	
			   uid:"",
			 },  
			fullscreenLoading:false,
			tableData: [],
		},
		created:function(){
			parent.vueData.$data.hreHtml = "../applyShop/index.html";
			parent.vueData.activeIndex = "3";
			parent.vueData.getLeftNav("3")
			parent.vueData.$data.categoryIndex = 1
			this.getApplyShopList(1)
		},
		methods:{
			getApplyShopList(page){
			   	this.fullscreenLoading = true;
			   	let param = {
			   		page: page,
			   	}
			   	axios({
			   		url: POSTURL.getApplyList,
			   		method: 'post',
			   		data: param
			   	}).then(response => {
			   		this.fullscreenLoading = false;
			   		if (response.data.code === 100) {
			   			 this.tableData =  response.data.result
			   		} else {
			   			this.$message.error(response.data.message);
			   		}
			   	}).catch(error => {
			   		this.fullscreenLoading = false;
			   		console.log(error);
			   		this.$message.error('服务器出错!');
			   	})
			},
			//通过审核店铺
			handleEdit(val){
				 this.changeShopInfo(val.uid,0,val.userId,val.name)
			},
			//拒绝店铺
			handleDelete(val){
				
				this.form.uid = val.uid
				this.form.userId = val.userId
				this.form.name = val.name
				this.dialogFormVisible = true
			},
			configRefuse(){
				this.dialogFormVisible = false
				this.changeShopInfo(this.form.uid,2,this.form.userId,this.form.name)
			},
			changeShopInfo(uid,status,userId,name){
				this.fullscreenLoading = true;
				let param = {
					uid:uid,
					auditStatus:status,
					userId:userId,
					name:name,
					
				}
				if(status == 2){
					param.cause = this.form.reason
				}
				
				axios({
					url: POSTURL.auditShop,
					method: 'post',
					data: param
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						 this.getApplyShopList(1)
						 if(status == 2){
						 	this.form = {}
						 }
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				}) 
			},
			
			
		}
	})
})